﻿using System;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;

namespace Engine.Terrain
{
    [Serializable]
    public struct VertexPositionTexture2Normal
    {

        public VertexPositionTexture2Normal(Vector3 position, Vector3 normal, Vector2 tex0, Vector2 tex1)
        {
            Position = position;
            Normal = normal;
            Texture0 = tex0;
            Texture1 = tex1;
        }

        public Vector3 Position;
        public Vector3 Normal;
        public Vector2 Texture0;
        public Vector2 Texture1;

        public static int SizeInBytes = 40;

        public static VertexElement[] VertexElements
        {
            get
            {
                VertexElement element1 = new VertexElement(0, VertexElementFormat.Vector3, VertexElementUsage.Position,
                                                           0);
                VertexElement element2 = new VertexElement(12, VertexElementFormat.Vector3, VertexElementUsage.Normal, 0);
                VertexElement element3 = new VertexElement(24, VertexElementFormat.Vector2,
                                                           VertexElementUsage.TextureCoordinate, 0);
                VertexElement element4 = new VertexElement(32, VertexElementFormat.Vector2,
                                                           VertexElementUsage.TextureCoordinate, 1);

                return new[] {element1, element2, element3, element4};
            }
        }
    }
}
